package com.djhu.newscollector.crawel.imp.holder;

import com.djhu.newscollector.core.Holder.JobHolder;
import com.djhu.newscollector.core.job.BaseJob;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * Created by zw on 2018/2/11.
 */
public abstract class BaseJobHolder implements JobHolder{
    private static Logger logger = LogManager.getLogger(BaseJobHolder.class.getName());

    @Override
    public boolean add(BaseJob job) {
        if (contains(job)){
            logger.info("job has exist!!!" + job.id());
            return false;
        }else {
            add0(job);
            return true;
        }
    }

    public abstract void add0(BaseJob job);


}